import request from '@/config/axios'

// 交叉路口 VO
export interface intersectionVO {
  id: number // id
  bh: string // 唯一编号
  lng: string // 纬度
  lat: string // 经度
  poiid: string // 对应的poiid
  dllx: string // 道路类型
  dlmc: string // 道路名称
}

// 交叉路口 API
export const intersectionApi = {

  getdeviceinfopage: async (params: any) => {
    return await request.get({ url: `/deviceinfo/deviceinfo/page`, params })
  },

  // 查询部门
  deptsimple: async (params: any) => {
    return await request.get({ url: `/system/dept/list-all-simple`, params })
  },

  // 查询交叉路口 100条
  getjclkPage: async (params: any) => {
    return await request.get({ url: `/jclk/jclk/page`, params })
  },
  getjclkbyid: async (id: number) => {
    return await request.get({ url: `/jclk/jclk/get?id=` + id  })
  },

  // 查询交叉路口分页
  getintersectionPage: async (params: any) => {
    return await request.get({ url: `/intersection/intersection/page`, params })
  },

  getGJList: async (params: any) => {
    return await request.get({ url: `/barinfo/barinfo/page`, params })
  },

  // 查询交叉路口详情
  getintersection: async (id: number) => {
    return await request.get({ url: `/intersection/intersection/get?id=` + id })
  },

  // 新增交叉路口
  createintersection: async (data: intersectionVO) => {
    return await request.post({ url: `/intersection/intersection/create`, data })
  },

  // 修改交叉路口
  updateintersection: async (data: intersectionVO) => {
    return await request.put({ url: `/intersection/intersection/update`, data })
  },

  // 删除交叉路口
  deleteintersection: async (id: number) => {
    return await request.delete({ url: `/intersection/intersection/delete?id=` + id })
  },

  // 导出交叉路口 Excel
  exportintersection: async (params) => {
    return await request.download({ url: `/intersection/intersection/export-excel`, params })
  },

// ==================== 子表（杆件） ====================

  // 获得杆件列表
  getbarinfoListByDlbh: async (dlbh) => {
    return await request.get({ url: `/intersection/intersection/barinfo/list-by-dlbh?dlbh=` + dlbh })
  },

   // 获得杆件下的设备列表
   getbarinfoListBygjbh: async (gjbh) => {
    return await request.get({ url: `/intersection/intersection/deviceinfo/list-by-gjbh?gjbh=` + gjbh })
  },

// ==================== 子表（设备） ====================

  // 获得设备列表
  getdeviceinfoListByLkbh: async (lkbh) => {
    return await request.get({ url: `/intersection/intersection/deviceinfo/list-by-lkbh?lkbh=` + lkbh })
  }
}